<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Usuario
{
    var $CI;
    var $_table;

    public function __construct(){
        $this->CI =& get_instance();
        $this->CI->config->load('database_tables');
        $this->_table = $this->CI->config->item('dbtables');
        $this->CI->load->model('modelo_model');
    }

    function getArrayOperation($params = null){
        return array_slice($params, 1, count($params));
    }

    function add($request) {
        $params = $request->output_parameters();
        $response = array();
        $response[] = $this->CI->modelo_model->add($this->getArrayOperation($params), $this->_table['usuario']);
        $response[count($response)] = 'struct';
        return $this->CI->xmlrpc->send_response($response);
    }

    function delete($request) {
        $params = $request->output_parameters();
        $response = array();
        $response[] = $this->CI->modelo_model->delete($this->getArrayOperation($params), $this->_table['usuario']);
        $response[count($response)] = 'struct';
        return $this->CI->xmlrpc->send_response($response);
    }

    function update($request) {
        $params = $request->output_parameters();
        $response = array();
        $response[] = $this->CI->modelo_model->update($this->getArrayOperation($params), $this->_table['usuario']);
        $response[count($response)] = 'struct';
        return $this->CI->xmlrpc->send_response($response);
    }

    function select($request) {
        $params = $request->output_parameters();
        $response = $this->CI->modelo_model->select($this->getArrayOperation($params), $this->_table['usuario']);
        return $this->CI->xmlrpc->send_response($response);
    }
}
?>